home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / machack / Hacks97 / WarriorsProgress.sit / Warrior’s Progress / source code / Source / Libraries / Windows / WindowLocation.cp < prev    next >
Text File  |  1997-06-28  |  833b  |  38 lines

  1. // WindowLocation.cp
  2.  
  3. #ifndef WindowLocation_h
  4. #include "WindowLocation.h"
  5. #endif
  6.  
  7. WindowLocation::WindowLocation( Rectangle available, PointObject reasonableSize )
  8.   : finished( 0 )
  9.   {
  10.     PointObject availableSize = available.Size();
  11.  
  12.     if ( reasonableSize.h > availableSize.h )
  13.         reasonableSize.h = availableSize.h;
  14.     if ( reasonableSize.v > availableSize.v )
  15.         reasonableSize.v = availableSize.v;
  16.     
  17.     stop.v = available.bottom - reasonableSize.v;
  18.     stop.h = available.left;
  19.     
  20.     location = available.TopLeft();
  21.     
  22.     location.h += 12;
  23.     if ( location.h + reasonableSize.h > available.right )
  24.         location.h = available.right - reasonableSize.h;
  25.   }
  26.  
  27. void WindowLocation::operator++()
  28.   {
  29.     Assert( Unfinished() );
  30.     
  31.     location += PointObject( -4, 16 );
  32.     
  33.     if ( location.h < stop.h )
  34.         location.h = stop.h;
  35.     
  36.     finished = location.v > stop.v;
  37.   }
  38.